home *** CD-ROM | disk | FTP | other *** search
/ Bath / Bath CDROM.iso / pc / MAP.DXR / 00001.ls next >
Encoding:
Text File  |  2001-07-26  |  5.0 KB  |  156 lines

  1. global stageHeight, stageWidth, VMiddle, HMiddle, leftStop, rightStop, topStop, bottomStop, speed, mapList, mag, minMag, maxMag, aspect, hotSpotSize, currentOnSite, held
  2.  
  3. on startMovie
  4.   set the blend of sprite 34 to 0
  5.   member(the memberNum of sprite 1).centerRegPoint = 1
  6.   cursor(2)
  7.   stageHeight = the stageBottom - the stageTop
  8.   stageWidth = the stageRight - the stageLeft
  9.   VMiddle = stageHeight / 2
  10.   HMiddle = stageWidth / 2
  11.   speed = 6.0
  12.   aspect = 1.25
  13.   mag = 1.0
  14.   minMag = 0.20000000000000001
  15.   maxMag = 0.69999999999999996
  16.   hotSpotSize = 45
  17.   held = 0
  18.   mapList = [11: [11, point(1392, 1657), "Abbey & Heritage Vaults", "Abbey"], 12: [12, point(962, 687), "Assembly Rms. & Mus. of Costume", "Assembly_Rooms"], 13: [13, point(1287, 1129), "Bath Postal Museum", "Postal_Museum"], 14: [14, point(1204, 544), "Building of Bath Museum", "Bath_Museum"], 15: [15, point(1406, 1518), "Guildhall", "Guildhall"], 16: [16, point(2340, 845), "Holburne Museum of Art", "Art_Museum"], 17: [17, point(872, 1088), "Jane Austen Centre", "Jane_Austen"], 18: [18, point(858, 1628), "Impossible Microworld", "Micro_World"], 19: [19, point(1280, 1716), "Pump Room", "Pump_Room"], 20: [20, point(1002, 286), "Museum of Bath at Work", "Work_Museum"], 21: [21, point(804, 622), "Museum of East Asian Art", "Asian_Museum"], 22: [22, point(1215, 1780), "New Spa", "New_Spa"], 23: [23, point(223, 534), "Royal Crescent & Circus", "Royal_Crescent"], 24: [24, point(1530, 1376), "Pulteney Bridge", "Pulteney_Bridge"], 25: [25, point(1531, 1784), "Sally Lunn's House", "Sally_Lunn"], 26: [26, point(1368, 1398), "Victoria Art Gallery", "Victoria"], 27: [27, point(1358, 1734), "Roman Baths", "Roman_Baths"], 28: [28, point(372, 617), "No. 1 Royal Crescent", "No1"]]
  19.   zoom(0.5)
  20.   zoom(1.00099999999999989)
  21. end
  22.  
  23. on deactivateWindow
  24.   tell the stage
  25.     bringMapToFront()
  26.   end tell
  27. end
  28.  
  29. on enterFrame me
  30.   if rollover(1) and (sprite(1).memberNum <> 6) then
  31.     if the rightMouseDown = 0 then
  32.       vOffset = curve(VMiddle - the mouseV, VMiddle) / speed
  33.       hOffset = curve(HMiddle - the mouseH, HMiddle) / speed
  34.       move(hOffset, vOffset)
  35.     end if
  36.   else
  37.     sprite(2).visible = 0
  38.   end if
  39. end
  40.  
  41. on curve x, scale
  42.   if x >= 0 then
  43.     return power(x, 2) / scale
  44.   else
  45.     return power(x, 2) / scale * -1
  46.   end if
  47. end
  48.  
  49. on move x, y
  50.   if held then
  51.     return 
  52.   end if
  53.   resetState()
  54.   hScale = member(the memberNum of sprite 1).width / float(sprite(1).width)
  55.   vScale = member(the memberNum of sprite 1).height / float(sprite(1).height)
  56.   leftStop = HMiddle * hScale
  57.   rightStop = member(the memberNum of sprite 1).width - (HMiddle * hScale)
  58.   topStop = VMiddle * vScale
  59.   bottomStop = member(the memberNum of sprite 1).height - (VMiddle * vScale)
  60.   newX = getAt(member(the memberNum of sprite 1).regPoint, 1) - x
  61.   newY = getAt(member(the memberNum of sprite 1).regPoint, 2) - y
  62.   member(the memberNum of sprite 1).regPoint = point(max(min(newX, rightStop), leftStop), max(min(newY, bottomStop), topStop))
  63.   showHotspots()
  64. end
  65.  
  66. on showHotspots
  67.   mapOrigin = point(sprite(1).left, sprite(1).top)
  68.   scale = sprite(1).width / float(member("Map").width)
  69.   repeat with i in mapList
  70.     set the loc of sprite getAt(i, 1) to (getAt(i, 2) * scale) + mapOrigin
  71.     set the width of sprite getAt(i, 1) to scale * hotSpotSize
  72.     set the height of sprite getAt(i, 1) to scale * hotSpotSize
  73.   end repeat
  74. end
  75.  
  76. on zoom x
  77.   if held then
  78.     return 
  79.   end if
  80.   if ((x < 1) and (mag > minMag)) or ((x > 1) and (mag < maxMag)) then
  81.     set the width of sprite 1 to max(sprite(1).width * x, stageWidth)
  82.     set the height of sprite 1 to sprite(1).width * aspect
  83.     mag = mag * x
  84.     move(0, 0)
  85.   end if
  86.   updateStage()
  87. end
  88.  
  89. on gotoSite site
  90.   if findPos(mapList, site) = VOID then
  91.     return 
  92.   end if
  93.   p = getAt(getaProp(mapList, site), 2)
  94.   p = p * member(the memberNum of sprite 1).width / member(4).width
  95.   member(the memberNum of sprite 1).regPoint = p
  96.   move(0, 0)
  97.   set the member of sprite site to member("node_over")
  98.   set the blend of sprite site to 100
  99.   str = getAt(getaProp(mapList, site), 3)
  100.   member("label").text = str
  101.   currentOnSite = site
  102. end
  103.  
  104. on resetState
  105.   if currentOnSite <> VOID then
  106.     set the member of sprite currentOnSite to member("hotSpot")
  107.     set the blend of sprite currentOnSite to 0
  108.     member("label").text = EMPTY
  109.     currentOnSite = VOID
  110.   end if
  111. end
  112.  
  113. on translateReg source, dest
  114.   x = member(dest).width / float(member(source).width) * getAt(member(source).regPoint, 1)
  115.   y = member(dest).height / float(member(source).height) * getAt(member(source).regPoint, 2)
  116.   member(dest).regPoint = point(x, y)
  117. end
  118.  
  119. on rightMouseDown me
  120.   startPos = the mouseV
  121.   repeat while the rightMouseDown = 1
  122.     offset = the mouseV - startPos
  123.     zoom(1 - (offset / 1000.0))
  124.   end repeat
  125. end
  126.  
  127. on keyDown
  128.   if the keyCode = 125 then
  129.     zoom(0.98999999999999999)
  130.   else
  131.     if the keyCode = 126 then
  132.       zoom(1 / 0.98999999999999999)
  133.     end if
  134.   end if
  135. end
  136.  
  137. on toggleKey
  138.   if the frame = 10 then
  139.     go(15)
  140.     held = 1
  141.   else
  142.     go(21)
  143.     held = 0
  144.   end if
  145. end
  146.  
  147. on showLabel str
  148.   put str
  149.   pass()
  150. end
  151.  
  152. on jumpToSite site
  153.   put site
  154.   pass()
  155. end
  156.